<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			body{
				height: 5000px;
			}
			#search{
				height: 40px;
				border: 2px solid red;
				border-radius: 20px;
				width: 400px;
				margin: 0 auto;
				text-align: center;
				position: sticky;
				top:20px;
			}
		</style>
	</head>
	<body>
		<div style="background-color: blue;height: 300px;"></div>
		<div id="search">
			<form>
				<input type="text"/><button>搜索</button>
			</form>
		</div>
	</body>
</html>